home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_06_02
/
v6n2011b.txt
< prev
next >
Wrap
Text File
|
1989-09-26
|
607b
|
25 lines
/* Define the record */
#define SIZE_A 10
/* Max size of string including the NUL terminator */
struct s_record
{
char a[SIZE_A];
int xx;
...
};
struct s_record record;
int record_number;
/* Write a record */
record_number = 12;
fseek(file,(long) RECORD_SIZE * record_number, 0);
fwrite(&record,RECORD_SIZE,1,file);
/* Read a record */
record_number = 12;
fseek(file,(long) RECORD_SIZE * record_number, 0);
fread(&record,RECORD_SIZE,1,file);